home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 62
/
Volume 62 - JOGO DISK .iso
/
Games
/
room-maker.swf
/
scripts
/
frame_1
/
DoAction.as
Wrap
Text File
|
2008-03-17
|
3KB
|
99 lines
function init()
{
menuText = ["","","","","","","",""];
iconFrames = [2,3,4,5,6,7,8,9];
currentLeftItem = 0;
gridX = 140;
gridY = 26;
numColumns = 5;
hGap = 12;
numColumns = numColumns <= menuText.length ? numColumns : menuText.length;
currentLeftItem = currentLeftItem >= 0 ? currentLeftItem : 0;
currentLeftItem = currentLeftItem <= menuText.length - numColumns ? currentLeftItem : menuText.length - numColumns;
generateCarouselMenu(menuText,iconFrames,currentLeftItem,gridX,gridY,numColumns,hGap);
}
function generateCarouselMenu(menuText, frameList, leftItemNum, gridX, gridY, numColumns, hGap)
{
_root.attachMovie("emptyclip","grid",1000);
grid._x = gridX;
grid._y = gridY;
grid.attachMovie("tile","tile" + leftItemNum,2);
grid["tile" + leftItemNum].text = menuText[leftItemNum];
grid["tile" + leftItemNum].icon.gotoAndStop(frameList[leftItemNum]);
var tileWidth = grid["tile" + leftItemNum]._width;
if(numColumns < menuText.length)
{
grid.attachMovie("navArrow","leftArrow",0);
grid.leftArrow._xscale = -100;
grid.leftArrow._alpha = 60;
grid.leftArrow._x -= hGap - 10;
grid.leftArrow._y = grid["tile" + leftItemNum]._height / 2 - grid.leftArrow._height / 2;
if(leftItemNum == 0)
{
grid.leftArrow.gotoAndStop("disabled");
}
}
var columnXOffset = tileWidth + hGap;
var i = 1;
while(i < numColumns)
{
grid.attachMovie("tile","tile" + (leftItemNum + i),2 + i);
var thisTile = grid["tile" + (leftItemNum + i)];
thisTile.icon.gotoAndStop(frameList[leftItemNum + i]);
thisTile._x = columnXOffset;
columnXOffset += tileWidth + hGap;
i++;
}
if(numColumns < menuText.length)
{
grid.attachMovie("navArrow","rightArrow",2 + i);
grid.rightArrow._x = columnXOffset + 30;
grid.rightArrow._alpha = 60;
grid.rightArrow._y = grid["tile" + leftItemNum]._height / 2 - grid.rightArrow._height / 2;
if(leftItemNum == menuText.length - numColumns)
{
grid.rightArrow.gotoAndStop("disabled");
}
}
}
function next()
{
if(!_root.mc_hittester.hitTest(_root.help))
{
if(currentLeftItem < menuText.length - numColumns)
{
currentLeftItem++;
generateCarouselMenu(menuText,iconFrames,currentLeftItem,gridX,gridY,numColumns,hGap);
}
}
}
function prev()
{
if(!_root.mc_hittester.hitTest(_root.help))
{
if(currentLeftItem > 0)
{
currentLeftItem--;
generateCarouselMenu(menuText,iconFrames,currentLeftItem,gridX,gridY,numColumns,hGap);
}
}
}
function removeMenu()
{
removeMovieClip("rightArrow");
removeMovieClip("lefttArrow");
removeMovieClip("grid");
}
s1 = new Sound();
s2 = new Sound();
s3 = new Sound();
s4 = new Sound();
s5 = new Sound();
s6 = new Sound();
s1.loadSound("s1.mp3",false);
s2.loadSound("s2.mp3",false);
s3.loadSound("s3.mp3",false);
s4.loadSound("s4.mp3",false);
s5.loadSound("s5.mp3",false);
s6.loadSound("BITE.mp3",false);